UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TBP/hL4w7CkDwFK3M6AltCuJXrmsyY1v+wLDOkLhfXc=' 
WHERE 
  key_id = '3ae172a30f016e76eb24b421b1bbcc798b6bf6f9c08d4a141dab7a9533799378' 
  AND (
    token = 'TBP/hL4w7CkDwFK3M6AltCuJXrmsyY1v+wLDOkLhfXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016