UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ejD263h2j+qGKAG4S9498wGUfvxWd/EaNTUBAvXpeCg='
WHERE
key_id = 'a7227f8d19ade8aa58866f941b69c9555d7977fb854eccb74af55e965e9e0fa6'
AND (
token = 'ejD263h2j+qGKAG4S9498wGUfvxWd/EaNTUBAvXpeCg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)