UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O9eIZ5ehjhcbNcUg+Vw8tAnj9wIfGaSeBqC82x+GYKs=' 
WHERE 
  key_id = '1d75bd0f30a5049faae6bb0eb600c4fe79d739f1080036ef422e57ce73d972d4' 
  AND (
    token = 'O9eIZ5ehjhcbNcUg+Vw8tAnj9wIfGaSeBqC82x+GYKs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039