UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bNF3B8aBX9yANIiQgRMNW4N6TUZ5ax7MA5mcFG4+b8g='
WHERE
key_id = 'b610a9a3c38294033d2919571c4264a1706d0965b8b26920a0d6057031986002'
AND (
token = 'bNF3B8aBX9yANIiQgRMNW4N6TUZ5ax7MA5mcFG4+b8g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)