UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MijMViOReiB1N/3eVjRBGoedZw8yAxkvZCNwJ1YqBgo='
WHERE
key_id = 'c7616323db39a4f04855366d752c8def817fbc8ed599e92c3bcb2c56f71a7b6b'
AND (
token = 'MijMViOReiB1N/3eVjRBGoedZw8yAxkvZCNwJ1YqBgo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)