UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HCQviBX9EDtptKhgwxutFFHsmiAQWQHD/+mo691kQ7w='
WHERE
key_id = '9164fe484b28cdbff6495a6ead979eb7264d1f21fdafb5ce674a2877f4a43f30'
AND (
token = 'HCQviBX9EDtptKhgwxutFFHsmiAQWQHD/+mo691kQ7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)