UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XNii9j5Ie92yclIRDHrzmzZIbIzOVS9E4g/gOd4UePk='
WHERE
key_id = 'ca32e7898ef946f22e90c7b569d2b812b0adfd46d58a807960ef587edfcbbebf'
AND (
token = 'XNii9j5Ie92yclIRDHrzmzZIbIzOVS9E4g/gOd4UePk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)