UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q1QVmmQ+sskJVilTWU3WvTV17XzlcVJGYCpY4s7RAwI='
WHERE
key_id = 'b6c54007bc3cc5bfcb884b2777a567198db1421031229ed98b95c3a844b0d4b3'
AND (
token = 'q1QVmmQ+sskJVilTWU3WvTV17XzlcVJGYCpY4s7RAwI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)