UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qgqf5XxSgt2ydfDPHy04Ep3bgBsq6JIb1nTM9BOQeWE=' 
WHERE 
  key_id = '7ee48a9ef3e976643b33a4432dec6c3de0f9dbac76e025396ec4a79a8d325737' 
  AND (
    token = 'Qgqf5XxSgt2ydfDPHy04Ep3bgBsq6JIb1nTM9BOQeWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040