UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UwaDrVwW6cFVCdYUruUebIYjlLvMDVloxeMAt6VBFZs='
WHERE
key_id = 'e2ea80f12313b5e53fe8404c721cc524b7304ac2930d3bc178c832337fa3c034'
AND (
token = 'UwaDrVwW6cFVCdYUruUebIYjlLvMDVloxeMAt6VBFZs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)