UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K7abyK1QMRuICepWhtKkc1ZXFojZ/rpPw221kXEUQcI='
WHERE
key_id = '113cee7f3c16a87b5773e9cb9a27c23bc74f03ca9ca114dd4b4908fe39e7a42c'
AND (
token = 'K7abyK1QMRuICepWhtKkc1ZXFojZ/rpPw221kXEUQcI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)