UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g6vzwYWyyeoIHU0FgRyCsyzzfiJsB+OgVScXlvjFXrI='
WHERE
key_id = '51f737929195bf17a64ed6af82f980de423e43f57c65f8500be76b4cf3dfb5ea'
AND (
token = 'g6vzwYWyyeoIHU0FgRyCsyzzfiJsB+OgVScXlvjFXrI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)