UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TNn0OmcMWqPpZhMV8m49XT2keTfGHNnFFai6VASwoZo='
WHERE
key_id = '6ad07e089f1929cc9f7fcf9736d7ea9e9fecf63f98ac62aea9b179156700251e'
AND (
token = 'TNn0OmcMWqPpZhMV8m49XT2keTfGHNnFFai6VASwoZo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)