UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4654IsWN21PWmRasONfrZWniyUx1jpw1Kse5yRzF9/8='
WHERE
key_id = 'f3a8f2b14c2ec96836709891165fb47b66aa4091662999997ebe4f5f1c472890'
AND (
token = '4654IsWN21PWmRasONfrZWniyUx1jpw1Kse5yRzF9/8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)