UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QmKUrHyOuWRB8Cxw2BO652CmYPUMtGeVanceE6IGNDs=' 
WHERE 
  key_id = '450cb691f1dcbb0bd0443610710e9cf549cad7bfe06c7bc0f0c65f1b4902cbd1' 
  AND (
    token = 'QmKUrHyOuWRB8Cxw2BO652CmYPUMtGeVanceE6IGNDs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00013