UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tnX/Z0CJvsmN8hDUdo8+J/26y4qly/6HZ9MRBlWPwz4='
WHERE
key_id = 'd31faf86da3c05d88f5629a2056c01bc753a3b8df261bc9ea842cebac3813579'
AND (
token = 'tnX/Z0CJvsmN8hDUdo8+J/26y4qly/6HZ9MRBlWPwz4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)