UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gKyvXMZnm2zb6YUontyEAORNWqWIOPq+zt1YkGpCvPA='
WHERE
key_id = 'f330dce630b0bd4d5bb596255e5fb8a541c72691b3e29d51b7be0e72c6ee7f6e'
AND (
token = 'gKyvXMZnm2zb6YUontyEAORNWqWIOPq+zt1YkGpCvPA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)