UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KOWK4HIhWgwfaCq4k+pXvyPJ4T13yeKS3LkjMJ7JTzY=' 
WHERE 
  key_id = 'fa5747acb800f082f2bf27123d2ff4252535714f2f02d61b10c3a01f6447d45d' 
  AND (
    token = 'KOWK4HIhWgwfaCq4k+pXvyPJ4T13yeKS3LkjMJ7JTzY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034