UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uIhgGDpXgxC8XsIzEHlggQYKpyr3qs4ZFiwwjtPvsLw=' 
WHERE 
  key_id = '3f77a054354ef70af927f1f75bb86e465393b98badee44f56edf992ec2f62f04' 
  AND (
    token = 'uIhgGDpXgxC8XsIzEHlggQYKpyr3qs4ZFiwwjtPvsLw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036