UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nLrFOXl+8TE0TRtX7gdVFQhHG5iEsZgdvba+msZbs/s='
WHERE
key_id = 'fc721c63d0b19c183a52b8e3ad72a6a03989810b259a1927af7efff10e17b456'
AND (
token = 'nLrFOXl+8TE0TRtX7gdVFQhHG5iEsZgdvba+msZbs/s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)