UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '66aaGpp0qEP4kunYmf7Wz0bjUZKNKeJvpHLwT+IxDSc='
WHERE
key_id = 'e6001920b3c6c5e60e23215adc6d488b927c1595af30d2f95c7a07246a280c8a'
AND (
token = '66aaGpp0qEP4kunYmf7Wz0bjUZKNKeJvpHLwT+IxDSc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)