UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yP9IQ2lOq4MTasHiqpUQ9OmFu3kaNiOd9/htBnevrhY='
WHERE
key_id = 'c3f1d422636d450da9daf2d11646232261b79546f77239b82e69f9d86241ff90'
AND (
token = 'yP9IQ2lOq4MTasHiqpUQ9OmFu3kaNiOd9/htBnevrhY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)