UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lNvhDT3lG7K6dml49Imz8s6V94mXwda6X2p8Q7qd/rg='
WHERE
key_id = '04364c417292fec9b635988b59b63ac2b2f9f4c696b545c0a2b4786d1e765f8d'
AND (
token = 'lNvhDT3lG7K6dml49Imz8s6V94mXwda6X2p8Q7qd/rg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)