UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sfX0wQT+s40FzYnpuO5oD2aC8+eJVor9L+yExHx6Sr0='
WHERE
key_id = 'e631c4ac558e60219fd64d8d198305c7ef759ccc32c37cf46bd410195da9cf99'
AND (
token = 'sfX0wQT+s40FzYnpuO5oD2aC8+eJVor9L+yExHx6Sr0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)