UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p8CUi1TF7xETYyrEk8SS6KbezxF0U0S2ff6n49dtTCA=' 
WHERE 
  key_id = '884678adbfa573c4b0c138e16ea378728388efbe24475164776ffec32d4af4d3' 
  AND (
    token = 'p8CUi1TF7xETYyrEk8SS6KbezxF0U0S2ff6n49dtTCA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034