UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V8FatniiUEXCSVfquoBSjCg8i/G740Wn4y8rSMJfbWs=' 
WHERE 
  key_id = '2f92db097d727eb7e9bd87ad11656fa38151097770158603a35308170338ee57' 
  AND (
    token = 'V8FatniiUEXCSVfquoBSjCg8i/G740Wn4y8rSMJfbWs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027