UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jqHJdkLqrwmNB32WvqyrsfCwS3sKYUYOO5OCW6tXrA0='
WHERE
key_id = 'ad65ae6849e37dd3fade9076be4a08c16c8476270047aeb3573158c0be3c5cf9'
AND (
token = 'jqHJdkLqrwmNB32WvqyrsfCwS3sKYUYOO5OCW6tXrA0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)