UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lOdSTPHYbHQoCILnb47oTLwsO1s8y1semKIsaEV7RyI='
WHERE
key_id = '8a5f664d07cfb0e40c421a4f8da4ea6769ce3cc40d7181eb249df0e6f83e19eb'
AND (
token = 'lOdSTPHYbHQoCILnb47oTLwsO1s8y1semKIsaEV7RyI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)