UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DRf0Lu1JX+dH7Yg1Gg1bqMnSdQJgoG6+s3aMHDQHXRI='
WHERE
key_id = 'dbbbc212c546189ae82a66e6ac51943f9690a99402413204b5760e7612b89771'
AND (
token = 'DRf0Lu1JX+dH7Yg1Gg1bqMnSdQJgoG6+s3aMHDQHXRI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)