UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd/234Mtoru4kkIqxO93oHG18LyMM1PiyvL55atM1uM8='
WHERE
key_id = 'bdd481fc0e5d7487817048243da0db578211c8c08c959f50df07f731683b5a98'
AND (
token = 'd/234Mtoru4kkIqxO93oHG18LyMM1PiyvL55atM1uM8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)