UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QTod/3z9tRP7oagrMEvdt46cugbcXbjaJztIUXcJMUM=' 
WHERE 
  key_id = '318d232c568dd4d7a7547c1187a6e6b27225a21229a6a7204a6c46e4c6e05724' 
  AND (
    token = 'QTod/3z9tRP7oagrMEvdt46cugbcXbjaJztIUXcJMUM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017