UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r2JZ38pdJbQQZekzCrYFTAgasvs1jTC7frcjFcf3Xmk='
WHERE
key_id = '771da346bdc524f992c71e9b04f17b1c186a8abe8eb17cde687f2802d105ff2a'
AND (
token = 'r2JZ38pdJbQQZekzCrYFTAgasvs1jTC7frcjFcf3Xmk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)