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