UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jGTRHJgq3T5is0lGrTj4h4J7HBXE9AvCwF5FGjst54I='
WHERE
key_id = 'd8e3a06277bee4b75cffdce8df46606d3515160439e012c8225c7ff9dd4f3086'
AND (
token = 'jGTRHJgq3T5is0lGrTj4h4J7HBXE9AvCwF5FGjst54I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)